package com.wedroid.r2d2.http;

import java.util.List;

import org.apache.http.client.methods.CloseableHttpResponse;

import com.wedroid.r2d2.contact.Contact;
import com.wedroid.r2d2.support.ResponseResult;
import com.wedroid.r2d2.support.response.ContactResponse;
import com.wedroid.r2d2.support.response.GroupResponse;
import com.wedroid.r2d2.support.response.InitResponse;
import com.wedroid.r2d2.support.response.SendingMsgResponse;
import com.wedroid.r2d2.support.response.SyncCheckResponse;
import com.wedroid.r2d2.support.response.SyncResponse;
import com.wedroid.r2d2.support.response.login.LoginStatus;

/**
 * @author lute
 */
public interface RequestManager extends Endpoint {

    /**
     * Shutdown request manager
     */
    public void shutdown();

    /**
     * Get UUID for QR code image URL generation.
     * @return
     */
    public String getUUID();

    /**
     * Request whether user has scanned QR code and confirm to login.
     * @param uuid  the UUID of QR code
     * @param tip   the tip parameter
     * @return
     */
    public LoginStatus requestLoginStatus(String uuid, int tip);

    /**
     * Redirect to the URI retrieved from login poll request.
     */
    public boolean postLoginRedirect();

    /**
     * Initialize WeChat data after login
     * @return
     */
    public ResponseResult<InitResponse> init();

    /**
     *
     */
    public void statusNotify();

    /**
     * @return
     */
    public ResponseResult<SyncCheckResponse> syncCheck();

    /**
     * @return
     */
    public ResponseResult<SyncResponse> sync();

    /**
     * @return
     */
    public ResponseResult<ContactResponse> getContacts();

    /**
     * @param groups
     * @return
     */
    public ResponseResult<GroupResponse> getGroupMember(List<Contact> groups);

    /**
     * @param msgId
     * @param isSlave
     * @return
     */
    public CloseableHttpResponse getImageMessage(String msgId, boolean isSlave);

    /**
     * @param msgId
     * @return
     */
    public CloseableHttpResponse getVoiceMessage(String msgId);

    /**
     * @param contact
     * @return
     */
    public CloseableHttpResponse getHeadImg(Contact contact);

    /**
     * @param contact
     * @param chatRoomId
     * @return
     */
    public CloseableHttpResponse getIcon(Contact contact, String chatRoomId);

    /**
     * @param path
     * @return
     */
    public CloseableHttpResponse getPublicLinkImg(String path);

    /**
     * @param content
     * @param toUserName
     * @return
     */
    public ResponseResult<SendingMsgResponse> sendText(String content, String toUserName);

    /**
     * @param path
     * @param toUserName
     * @return
     */
    public ResponseResult<SendingMsgResponse> sendImage(String path, String toUserName);

}
